﻿


-- 只能匹配人员和卡信息
create procedure [dbo].[RyCaInfo_Add_Auto]
as
select identity(int,1,1) idx,sfzh into #ryinfo from Ry_Info where sfzh not in(select sfzh from RyCa_Info where cxsj is null) and ygzt=1
select identity(int,1,1) idx,kh into #cardinfo from Ca_Info where kh not in(select kh from RyCa_Info where cxsj is null) and sfyx=1
insert into RyCa_Info(sfzh,kh,fksj)
select sfzh,kh,getdate() fksj from 
#ryinfo inner join #cardinfo
on(#ryinfo.idx=#cardinfo.idx)